package tron.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
import tron.entity.Tron;

@RestController
public class WebFluxController {

    @Autowired
    TronHandler tronHandler;

    @GetMapping("/test01")
    public Mono<Tron> test01()  {
        final String name = Thread.currentThread().getName();
        final long id = Thread.currentThread().getId();
        System.out.println("休眠开始========"+id);
        try {
            Thread.sleep(5000);
            System.out.println("服务器休眠5秒");
        } catch (InterruptedException e) {

        }
        System.out.println("休眠结束========"+id);
        return tronHandler.getTron();
    }

}
